<?php

$ip = $_GET[ip];

echo $ip;

$fp = fopen('tmp/data.txt', 'w');
fwrite($fp, $ip);
fclose($fp);